<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%--
  Created by IntelliJ IDEA.
  User: tql
  Date: 2020/11/25
  Time: 21:25
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>管理员个人信息</title>
    <link rel="stylesheet" href="https://cdn.staticfile.org/twitter-bootstrap/3.3.7/css/bootstrap.min.css">
    <script src="https://cdn.staticfile.org/jquery/2.1.1/jquery.min.js"></script>
    <script src="https://cdn.staticfile.org/twitter-bootstrap/3.3.7/js/bootstrap.min.js"></script>
    <link href="../css/admin_info.css" rel="stylesheet" type="text/css"/>
    <script src="../js/admin_info.js"></script>
</head>
<% String path = request.getContextPath();%>
<body>

    <div id="main">
        <div id="mainContent">
            <%--基本信息表单--%>
            <form action="<%=path%>/updateAdminBasicInfo" method="post" enctype="multipart/form-data">
                <div id="item-label-main" class="left-margin">
                    <div style="text-align: center;color: red"><h5>${msg}</h5></div>
                    <p><h3>个人信息</h3></p>
                    <h5>提交的图片请小于2M</h5>
                </div>
                <%--头像--%>
                <div id="item-avatar" class="left-margin">
                    <div id="avatar-div">
                        <c:if test="${currentUser.admin_image == null}">
                            <img name="" id="avatar" src="../img/avatar.jpg" alt="图片走丢了"/>
                        </c:if>
                        <c:if test="${currentUser.admin_image != null}">
                            <img name="" id="avatar" src="<%=path%>/getImg?id=${currentUser.admin_Id}" alt="图片走丢了"/>
                        </c:if>
                    </div>
                    <input type="file" accept="image/*" name="uploadavatar" id="uploadavatar" onchange="showAvatar(this)" />
                    <input type="button" class="btn btn-default" name="uploadavatarbtn" id="uploadavatarbtn" value="点击上传" onclick="uploadfile()"/>
                </div>
                <hr>

                <div id="item-label-primary" class="left-margin">
                    <p><h4>基本信息</h4><h5><i style="color: red">*</i>号为必填项</h5></p>
                </div>
                <div id="primary" class="left-margin">
                    <%--昵称--%>
                    <div id="user-name" class="input-group">
                        <div class="label-div">
                            <label for="username">昵称</label>
                            <span class="must-span">*</span>
                        </div>
                        <input type="text" id="username" name="username" value="${currentUser.admin_name}" class="form-control" minlength="1" maxlength="20" placeholder="昵称长度不能超过20" onblur="checkUserName()"/>
                        <small><span id="username-tip"></span></small>
                    </div>
                    <%--性别--%>
                    <div id="sex" class="btn-group" data-toggle="buttons">
                        <div class="label-div">
                            <label>性别</label>
                            <%--必选的星号--%>
                            <%--<span class="must-span">*</span>--%>
                        </div>
                        <input type="radio" name="sex" id="male" <c:if test="${currentUser.admin_sex.equals('male')}">checked="checked"</c:if> value="male"/><label for="male" class="sex-margin">男</label>
                        <input type="radio" name="sex" id="female" <c:if test="${currentUser.admin_sex.equals('female')}">checked="checked"</c:if> value="female"/><label for="female" class="sex-margin">女</label>
                        <input type="radio" name="sex" id="secret" <c:if test="${currentUser.admin_sex.equals('secret')}">checked="checked"</c:if> value="secret"/><label for="secret" class="sex-margin">保密</label>
                        <small><span id="sex-tip"></span></small>
                    </div>
                    <%--出生日期--%>
                    <div id="date">
                        <div class="label-div">
                            <label for="birthday">出生日期</label>
                            <%--<span class="must-span">*</span>--%>
                        </div>
                        <input type="date" name="birthday" id="birthday" value="${currentUser.admin_born}" />
                        <small><span id="birthday-tip"></span></small>
                    </div>
                    <%--手机号码--%>
                    <div class="input-group">
                        <div class="label-div">
                            <label for="phone">手机号码</label>
                            <%--<span class="must-span">*</span>--%>
                        </div>
                        <input type="tel" name="phone" id="phone" value="${currentUser.admin_phone}" class="form-control" minlength="11" maxlength="11" placeholder="请输入11位号码" onblur="checkPhone()"/>
                        <small><span id="phone-tip"></span></small>
                    </div>
                    <%--简介--%>
                    <div class="input-group">
                        <div class="label-div">
                            <label for="introduction">个人简介</label>
                            <%--<span class="must-span">*</span>--%>
                        </div>
                        <textarea name="introduction" id="introduction"  class="form-control" rows="3" placeholder="最多输入100字" maxlength="100">${currentUser.admin_brief}</textarea>
                        <small><span id="introduction-tip"></span></small>
                    </div>
                    <%--提交按钮--%>
                    <div>
                        <button type="button" class="btn btn-default" id="sub1" onclick="checkForm1()">提交</button>
                    </div>
                </div>
            </form>

            <hr>

            <%--密码表单--%>
            <form action="<%=path%>/updateAdminPas" method="post">
                <div id="pwd-div" class="left-margin">
                    <div id="item-label-pwd">
                        <p><h4>修改密码</h4></p>
                    </div>
                    <%--新密码--%>
                    <div class="input-group">
                        <div class="label-div">
                            <label for="pwd1">请输入新密码</label>
                            <%--<span class="must-span">*</span>--%>
                        </div>
                        <input type="password" name="password" id="pwd1" class="form-control" placeholder="请输入新密码" autocomplete="off" onblur="checkPwd1()"/>
                        <small><span id="pwd1-tip"></span></small>
                    </div>
                    <%--再次输入密码--%>
                    <div class="input-group">
                        <div class="label-div">
                            <label for="pwd2">请再次输入密码</label>
                            <%--<span class="must-span">*</span>--%>
                        </div>
                        <input type="password" name="password2" id="pwd2" class="form-control" placeholder="请再次输入密码" autocomplete="off" onblur="checkPwd2()"/>
                        <small><span id="pwd2-tip"></span></small>
                    </div>
                    <%--提交按钮--%>
                    <div>
                        <button type="button" class="btn btn-default" id="sub2" onclick="checkForm2()">提交</button>
                    </div>
                </div>
            </form>
        </div>
    </div>
</body>
</html>
